package com.dubbo.snail.httpService.factory;

import com.dubbo.snail.httpService.NacosProviderFeign;
import com.dubbo.snail.httpService.fallback.NacosProviderFeignFallback;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @Description TODO
 * @Author xueguoping
 * @Date 2021/5/11 19:18
 */
@Component
public class NacosProviderFeignFallbackFactory implements FallbackFactory<NacosProviderFeign> {

	private final NacosProviderFeignFallback nacosProviderFeignFallback;

	public NacosProviderFeignFallbackFactory(NacosProviderFeignFallback nacosProviderFeignFallback){
		this.nacosProviderFeignFallback = nacosProviderFeignFallback;
	}

	public NacosProviderFeign create(Throwable throwable) {
		throwable.printStackTrace();
		return nacosProviderFeignFallback;
	}
}
